package com.tzpay.tzpay.api;

/**
 * Created by chenfeiyue on 16/4/7.
 */
public class TzBaseResponse {
    int resMsg = -1;

    //0表示成功 10000 ：时间错误   10001：设备未授权  10002:用户密码错误,10003:数据库连线失败,10004:写入数据失败，10005:交易查询失败，10006:未找到商户信息，10007:参数缺少，10008:参数错误
    public int getResMsg() {
        return resMsg;
    }

    public void setResMsg(int resMsg) {
        this.resMsg = resMsg;
    }

    public boolean isSuccess() {
        return resMsg == 0;
    }

    public String getErrorMessage() {
        String msg = "操作失败，请重试";
        switch (resMsg) {
            case 0:
                msg = "成功";
                break;
            case 10000:
                msg = "时间错误";
                break;
            case 10001:
                msg = "设备未授权";
                break;
            case 10002:
                msg = "用户密码错误";
                break;
            case 10003:
                msg = "时间错误";
                break;
            case 10004:
                msg = "写入数据失败";
                break;
            case 10005:
                msg = "交易查询失败";
                break;
            case 10006:
                msg = "未找到商户信息";
                break;
            case 10007:
                msg = "参数缺少";
                break;
            case 10008:
                msg = "参数错误";
                break;
        }
        return msg;
    }

}
